package com.srv.persistence;

import com.srv.model.TheBaseObj;
import com.srv.model.User;

/**
 * @author Administrator
 *
 */
public interface IPersistence {
	
	/**
	 * 是否合法的ID.<br/>
	 * 合法的含义：1）格式合法，2）真正被生成过.
	 * @param id
	 * @return
	 * @throws PersistenceException
	 */
	public abstract boolean isValidID(String id) throws PersistenceException;
	/**
	 * 创建ID
	 * @return ID
	 * @throws PersistenceException
	 */
	public String getID() throws PersistenceException;
	
	/**
	 * 创建ID数组
	 * @param counter - 个数
	 * @return id数组
	 * @throws PersistenceException
	 */
	public String[] getIDArray(int counter) throws PersistenceException;
	
	/**
	 * 保存
	 * @param perObject - 需要保存的对象
	 * @throws PersistenceException
	 */
	public void save(TheBaseObj perObject)throws PersistenceException;
	
	/**
	 * 删除
	 * @param theOwner - 用户对象
	 * @param perObjectID - 对象ID
	 * @throws PersistenceException
	 */
	public void del(User theOwner,String perObjectID)throws PersistenceException;
	
}
